import React from 'react';
import {QuestionTitleDefaultProps, QuestionTitlePropsType} from "./interface";
import {Typography} from "antd";

const {Title} = Typography
const QuestionTitle: React.FC<QuestionTitlePropsType> = (props: QuestionTitlePropsType) => {
  console.log('props', props)
  const {isCenter = false, text = '', level = 1} = {...QuestionTitleDefaultProps, ...props}
  const getFontSize = (level: number) => {
    switch (level) {
      case 1:
        return '24px'
      case 2 :
        return '20px'
      default:
        return '16px'
    }
  }
  return (
    <Title level={level}
           style={{textAlign: isCenter ? 'center' : 'start', fontSize: getFontSize(level)}}>{text}</Title>
  );
};

export default QuestionTitle;
